package com.shitou.util;

import java.io.IOException;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.SimpleTagSupport;


public class IssuesStateTag extends SimpleTagSupport {
	
	private Integer state;
	private String name;
	
	@Override
	public void doTag() throws JspException, IOException {
		JspWriter out = getJspContext().getOut();
		out.print("<select name=\""+name+"\">");
		if(AssignmentUtil.UNASSIGNED == state) {
			out.print("<option value=\""+AssignmentUtil.SOLVING+"\">开始解决</option>");
			out.print("<option value=\""+AssignmentUtil.CLOSED+"\">关闭</option>");
		} else if(AssignmentUtil.SOLVING == state) {
			out.print("<option value=\""+AssignmentUtil.SUSPEND+"\">暂停解决</option>");
			out.print("<option value=\""+AssignmentUtil.SLOVED+"\">标记为已解决</option>");
		} else if(AssignmentUtil.SUSPEND == state) {
			out.print("<option value=\""+AssignmentUtil.SOLVING+"\">继续解决</option>");
			out.print("<option value=\""+AssignmentUtil.CLOSED+"\">关闭</option>");
		} else if(AssignmentUtil.SLOVED == state) {
			out.print("<option value=\""+AssignmentUtil.SOLVING+"\">继续解决</option>");
			out.print("<option value=\""+AssignmentUtil.CLOSED+"\">关闭</option>");
		} else if(AssignmentUtil.CLOSED == state) {
			out.print("<option value=\""+AssignmentUtil.REOPEN+"\">重新开放</option>");
		} else if(AssignmentUtil.REOPEN == state) {
			out.print("<option value=\""+AssignmentUtil.SOLVING+"\">开始解决</option>");
			out.print("<option value=\""+AssignmentUtil.CLOSED+"\">关闭</option>");
		}
	}

	public Integer getState() {
		return state;
	}

	public void setState(Integer state) {
		this.state = state;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	
}
